package com.xyzwps.orm.gsql.repository

import com.xyzwps.orm.gsql.App
import com.xyzwps.orm.repository.TablesRepository
import com.xyzwps.orm.testcase.TagRepositoryCase
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

class TagRepositoryTest {
    TagRepositoryCase tagCase
    TablesRepository tablesRepo

    TagRepositoryTest() {
        def app = new App()
        def tagRepo = new GsqlTagRepository(app.sql)
        this.tagCase = new TagRepositoryCase(tagRepo)
        this.tablesRepo = new GsqlTablesRepository(app.sql)
    }

    @BeforeEach
    void beforeEach() {
        this.tablesRepo.cleanAllTables()
    }

    @Test
    void testInsertAndGetOk() {
        tagCase.caseInsertAndGetOk()
    }

    @Test
    void testInsertTagDuplicate() {
        tagCase.caseInsertTagDuplicate()
    }

    @Test
    void testUpdateOk() {
        tagCase.caseUpdateOk()
    }

    @Test
    void testUpdateTagDuplicate() {
        tagCase.caseUpdateTagDuplicate()
    }

    @Test
    void testUpdateNonExistedTag() {
        tagCase.caseUpdateNonExistedTag()
    }

    @Test
    void testDeleteExistedTag() {
        tagCase.caseDeleteExistedTag()
    }

    @Test
    void testDeleteNonExistedTag() {
        tagCase.caseDeleteNonExistedTag()
    }

    @Test
    void testSelectAllForUser() {
        tagCase.caseSelectAllForUser()
    }
}